﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace FitProtocolLibrary
{
    public class FitDataMessage : FitMessage
    {
        public FitDefinitionMessage DefinitionMessage;
        public List<FitField> Fields;

        public FitDataMessage(FitMessage message, FitDefinitionMessage definitionMessage, BinaryReader r) : base(message.Header.Header)
        {
            this.Fields = new List<FitField>();
            this.DefinitionMessage = definitionMessage;
            foreach (FitField d in definitionMessage.FieldDefinitions)
            {
                FitField f = new FitField(d);
                f.Value = r.ReadBytes(f.Size);
                this.Fields.Add(f);
            }
        }
    }
}
